package day04;

import java.util.Scanner;

/**
 * 说明:
 *
 * @author:SuZhongHe
 * @date:2023/2/15
 **/
public class Guessing {
    public static void main(String[] args) {
        int random = (int)(Math.random()*100+1);
        System.out.println(random);
        Scanner scanner = new Scanner(System.in);
        System.out.println("猜吧");

        int guess = scanner.nextInt();
        int times =0;
        while (guess!=random){

            if (guess>random){
                System.out.println("猜大了");
            }else {
                System.out.println("猜小了");
            }
            System.out.println("继续猜吧");
            guess=scanner.nextInt();
            times++;
        }
        System.out.println("猜对了,"+"一共猜了"+times+1+"次.");
    }
}
